<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Voro++: v_base.hh Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Voro++
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript" src="dynsections.js"></script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">v_base.hh</div>  </div>
</div>
<div class="contents">
<a href="v__base_8hh.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Voro++, a 3D cell-based Voronoi library</span>
<a name="l00002"></a>00002 <span class="comment">//</span>
<a name="l00003"></a>00003 <span class="comment">// Author   : Chris H. Rycroft (LBL / UC Berkeley)</span>
<a name="l00004"></a>00004 <span class="comment">// Email    : chr@alum.mit.edu</span>
<a name="l00005"></a>00005 <span class="comment">// Date     : August 30th 2011</span>
<a name="l00006"></a>00006 <span class="comment"></span>
<a name="l00007"></a>00007 <span class="comment">/** \file v_base.hh</span>
<a name="l00008"></a>00008 <span class="comment"> * \brief Header file for the base Voronoi container class. */</span>
<a name="l00009"></a>00009 
<a name="l00010"></a>00010 <span class="preprocessor">#ifndef VOROPP_V_BASE_HH</span>
<a name="l00011"></a>00011 <span class="preprocessor"></span><span class="preprocessor">#define VOROPP_V_BASE_HH</span>
<a name="l00012"></a>00012 <span class="preprocessor"></span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &quot;<a class="code" href="worklist_8hh.html" title="Header file for setting constants used in the block worklists that are used during cell computation...">worklist.hh</a>&quot;</span>
<a name="l00014"></a>00014 
<a name="l00015"></a>00015 <span class="keyword">namespace </span>voro {
<a name="l00016"></a>00016 <span class="comment"></span>
<a name="l00017"></a>00017 <span class="comment">/** \brief Class containing data structures common across all particle container classes.</span>
<a name="l00018"></a>00018 <span class="comment"> *</span>
<a name="l00019"></a>00019 <span class="comment"> * This class contains constants and data structures that are common across all</span>
<a name="l00020"></a>00020 <span class="comment"> * particle container classes. It contains constants setting the size of the</span>
<a name="l00021"></a>00021 <span class="comment"> * underlying subgrid of blocks that forms the basis of the Voronoi cell</span>
<a name="l00022"></a>00022 <span class="comment"> * computations. It also constructs bound tables that are used in the Voronoi</span>
<a name="l00023"></a>00023 <span class="comment"> * cell computation, and contains a number of routines that are common across</span>
<a name="l00024"></a>00024 <span class="comment"> * all container classes. */</span>
<a name="l00025"></a><a class="code" href="classvoro_1_1voro__base.html">00025</a> <span class="keyword">class </span><a class="code" href="classvoro_1_1voro__base.html" title="Class containing data structures common across all particle container classes.">voro_base</a> {
<a name="l00026"></a>00026         <span class="keyword">public</span>:<span class="comment"></span>
<a name="l00027"></a>00027 <span class="comment">                /** The number of blocks in the x direction. */</span>
<a name="l00028"></a><a class="code" href="classvoro_1_1voro__base.html#a8aed82f1468c9bb7e2a779ea53a22594">00028</a>                 <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classvoro_1_1voro__base.html#a8aed82f1468c9bb7e2a779ea53a22594">nx</a>;<span class="comment"></span>
<a name="l00029"></a>00029 <span class="comment">                /** The number of blocks in the y direction. */</span>
<a name="l00030"></a><a class="code" href="classvoro_1_1voro__base.html#a83da5297e87173733d92d9024cebbbdb">00030</a>                 <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classvoro_1_1voro__base.html#a83da5297e87173733d92d9024cebbbdb">ny</a>;<span class="comment"></span>
<a name="l00031"></a>00031 <span class="comment">                /** The number of blocks in the z direction. */</span>
<a name="l00032"></a><a class="code" href="classvoro_1_1voro__base.html#aae461fbdf42c8975fb43d963d002298f">00032</a>                 <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classvoro_1_1voro__base.html#aae461fbdf42c8975fb43d963d002298f">nz</a>;<span class="comment"></span>
<a name="l00033"></a>00033 <span class="comment">                /** A constant, set to the value of nx multiplied by ny, which</span>
<a name="l00034"></a>00034 <span class="comment">                 * is used in the routines that step through blocks in</span>
<a name="l00035"></a>00035 <span class="comment">                 * sequence. */</span>
<a name="l00036"></a><a class="code" href="classvoro_1_1voro__base.html#aad5f41101fce781214d2f0b69487a729">00036</a>                 <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classvoro_1_1voro__base.html#aad5f41101fce781214d2f0b69487a729">nxy</a>;<span class="comment"></span>
<a name="l00037"></a>00037 <span class="comment">                /** A constant, set to the value of nx*ny*nz, which is used in</span>
<a name="l00038"></a>00038 <span class="comment">                 * the routines that step through blocks in sequence. */</span>
<a name="l00039"></a><a class="code" href="classvoro_1_1voro__base.html#a4309aca04ab561bd3b3921e9b73016a4">00039</a>                 <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classvoro_1_1voro__base.html#a4309aca04ab561bd3b3921e9b73016a4">nxyz</a>;<span class="comment"></span>
<a name="l00040"></a>00040 <span class="comment">                /** The size of a computational block in the x direction. */</span>
<a name="l00041"></a><a class="code" href="classvoro_1_1voro__base.html#ac8986e621bd70cf5113e231cb8694d37">00041</a>                 <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="classvoro_1_1voro__base.html#ac8986e621bd70cf5113e231cb8694d37">boxx</a>;<span class="comment"></span>
<a name="l00042"></a>00042 <span class="comment">                /** The size of a computational block in the y direction. */</span>
<a name="l00043"></a><a class="code" href="classvoro_1_1voro__base.html#a3ad6b0eefbdff03e92d30f5035defdd1">00043</a>                 <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="classvoro_1_1voro__base.html#a3ad6b0eefbdff03e92d30f5035defdd1">boxy</a>;<span class="comment"></span>
<a name="l00044"></a>00044 <span class="comment">                /** The size of a computational block in the z direction. */</span>
<a name="l00045"></a><a class="code" href="classvoro_1_1voro__base.html#afd53f018c9641c8b8066e9429c88a4e0">00045</a>                 <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="classvoro_1_1voro__base.html#afd53f018c9641c8b8066e9429c88a4e0">boxz</a>;<span class="comment"></span>
<a name="l00046"></a>00046 <span class="comment">                /** The inverse box length in the x direction. */</span>
<a name="l00047"></a><a class="code" href="classvoro_1_1voro__base.html#ad708515772990e5b2fa4e93c330f7aa0">00047</a>                 <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="classvoro_1_1voro__base.html#ad708515772990e5b2fa4e93c330f7aa0">xsp</a>;<span class="comment"></span>
<a name="l00048"></a>00048 <span class="comment">                /** The inverse box length in the y direction. */</span>
<a name="l00049"></a><a class="code" href="classvoro_1_1voro__base.html#a300808cb0ccab85eb61dd0b25a5076de">00049</a>                 <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="classvoro_1_1voro__base.html#a300808cb0ccab85eb61dd0b25a5076de">ysp</a>;<span class="comment"></span>
<a name="l00050"></a>00050 <span class="comment">                /** The inverse box length in the z direction. */</span>
<a name="l00051"></a><a class="code" href="classvoro_1_1voro__base.html#ac51553412117b42816210e54805ad278">00051</a>                 <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="classvoro_1_1voro__base.html#ac51553412117b42816210e54805ad278">zsp</a>;<span class="comment"></span>
<a name="l00052"></a>00052 <span class="comment">                /** An array to hold the minimum distances associated with the</span>
<a name="l00053"></a>00053 <span class="comment">                 * worklists. This array is initialized during container</span>
<a name="l00054"></a>00054 <span class="comment">                 * construction, by the initialize_radii() routine. */</span>
<a name="l00055"></a><a class="code" href="classvoro_1_1voro__base.html#ab59b5feedb35ea611b05d65df1216775">00055</a>                 <span class="keywordtype">double</span> *<a class="code" href="classvoro_1_1voro__base.html#ab59b5feedb35ea611b05d65df1216775">mrad</a>;<span class="comment"></span>
<a name="l00056"></a>00056 <span class="comment">                /** The pre-computed block worklists. */</span>
<a name="l00057"></a><a class="code" href="classvoro_1_1voro__base.html#aa6eda2569de04b8baa027db258f97f0d">00057</a>                 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classvoro_1_1voro__base.html#aa6eda2569de04b8baa027db258f97f0d">wl</a>[wl_seq_length*wl_hgridcu];
<a name="l00058"></a>00058                 <span class="keywordtype">bool</span> <a class="code" href="classvoro_1_1voro__base.html#a95d9ee6c1610afccf265198ae63b5e88">contains_neighbor</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* format);
<a name="l00059"></a>00059                 <a class="code" href="classvoro_1_1voro__base.html#a74f367e3bcffcd95c800ce9be85c29dc">voro_base</a>(<span class="keywordtype">int</span> nx_,<span class="keywordtype">int</span> ny_,<span class="keywordtype">int</span> nz_,<span class="keywordtype">double</span> boxx_,<span class="keywordtype">double</span> boxy_,<span class="keywordtype">double</span> boxz_);
<a name="l00060"></a>00060                 ~<a class="code" href="classvoro_1_1voro__base.html" title="Class containing data structures common across all particle container classes.">voro_base</a>() {<span class="keyword">delete</span> [] <a class="code" href="classvoro_1_1voro__base.html#ab59b5feedb35ea611b05d65df1216775">mrad</a>;}
<a name="l00061"></a>00061         <span class="keyword">protected</span>:<span class="comment"></span>
<a name="l00062"></a>00062 <span class="comment">                /** A custom int function that returns consistent stepping</span>
<a name="l00063"></a>00063 <span class="comment">                 * for negative numbers, so that (-1.5, -0.5, 0.5, 1.5) maps</span>
<a name="l00064"></a>00064 <span class="comment">                 * to (-2,-1,0,1).</span>
<a name="l00065"></a>00065 <span class="comment">                 * \param[in] a the number to consider.</span>
<a name="l00066"></a>00066 <span class="comment">                 * \return The value of the custom int operation. */</span>
<a name="l00067"></a><a class="code" href="classvoro_1_1voro__base.html#a37fd9fdedc5d415e55f3bbb22a786d8c">00067</a>                 <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="classvoro_1_1voro__base.html#a37fd9fdedc5d415e55f3bbb22a786d8c">step_int</a>(<span class="keywordtype">double</span> a) {<span class="keywordflow">return</span> a&lt;0?int(a)-1:int(a);}<span class="comment"></span>
<a name="l00068"></a>00068 <span class="comment">                /** A custom modulo function that returns consistent stepping</span>
<a name="l00069"></a>00069 <span class="comment">                 * for negative numbers. For example, (-2,-1,0,1,2) step_mod 2</span>
<a name="l00070"></a>00070 <span class="comment">                 * is (0,1,0,1,0).</span>
<a name="l00071"></a>00071 <span class="comment">                 * \param[in] (a,b) the input integers.</span>
<a name="l00072"></a>00072 <span class="comment">                 * \return The value of a modulo b, consistent for negative</span>
<a name="l00073"></a>00073 <span class="comment">                 * numbers. */</span>
<a name="l00074"></a><a class="code" href="classvoro_1_1voro__base.html#ab432b8bee0def0666ac39a132c721135">00074</a>                 <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="classvoro_1_1voro__base.html#ab432b8bee0def0666ac39a132c721135">step_mod</a>(<span class="keywordtype">int</span> a,<span class="keywordtype">int</span> b) {<span class="keywordflow">return</span> a&gt;=0?a%b:b-1-(b-1-a)%b;}<span class="comment"></span>
<a name="l00075"></a>00075 <span class="comment">                /** A custom integer division function that returns consistent</span>
<a name="l00076"></a>00076 <span class="comment">                 * stepping for negative numbers. For example, (-2,-1,0,1,2)</span>
<a name="l00077"></a>00077 <span class="comment">                 * step_div 2 is (-1,-1,0,0,1).</span>
<a name="l00078"></a>00078 <span class="comment">                 * \param[in] (a,b) the input integers.</span>
<a name="l00079"></a>00079 <span class="comment">                 * \return The value of a div b, consistent for negative</span>
<a name="l00080"></a>00080 <span class="comment">                 * numbers. */</span>
<a name="l00081"></a><a class="code" href="classvoro_1_1voro__base.html#a59a281a5e25e13f681c4f6a2c8bd1ca7">00081</a>                 <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="classvoro_1_1voro__base.html#a59a281a5e25e13f681c4f6a2c8bd1ca7">step_div</a>(<span class="keywordtype">int</span> a,<span class="keywordtype">int</span> b) {<span class="keywordflow">return</span> a&gt;=0?a/b:-1+(a+1)/b;}
<a name="l00082"></a>00082         <span class="keyword">private</span>:
<a name="l00083"></a>00083                 <span class="keywordtype">void</span> compute_minimum(<span class="keywordtype">double</span> &amp;minr,<span class="keywordtype">double</span> &amp;xlo,<span class="keywordtype">double</span> &amp;xhi,<span class="keywordtype">double</span> &amp;ylo,<span class="keywordtype">double</span> &amp;yhi,<span class="keywordtype">double</span> &amp;zlo,<span class="keywordtype">double</span> &amp;zhi,<span class="keywordtype">int</span> ti,<span class="keywordtype">int</span> tj,<span class="keywordtype">int</span> tk);
<a name="l00084"></a>00084 };
<a name="l00085"></a>00085 
<a name="l00086"></a>00086 }
<a name="l00087"></a>00087 
<a name="l00088"></a>00088 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>


<hr class="footer"/><address class="footer"><small>
Generated on Fri Sep 23 2011 22:49:06 for Voro++ by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
